<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div id="app"></div>
  </body>
  <script>
    let app = document.getElementById("app");
    let ele1 = document.createElement("li");
    ele1.innerHTML = "a";
    let ele2 = document.createElement("li");
    ele2.innerHTML = "b";
    let ele3 = document.createElement("li");
    ele3.innerHTML = "c";
    app.appendChild(ele1);
    app.appendChild(ele2);
    app.appendChild(ele3);
    let eleObj = {
      ele1,
      ele2,
      ele3,
    };
    eleObj.ele1.style.color = "red";
    eleObj.ele2.style.color = "green";
    app.insertBefore(eleObj.ele1, eleObj.ele3.nextSibling);
  </script>
</html>
